package com.langll.ai;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 *  测试chat advisor
 */
@SpringBootTest(classes = AIChatApplication.class)
@RunWith(SpringRunner.class)
public class TestChatAdvisor {

    @Autowired
    private ChatClient chatClient;

    @Test
    public void testSimpleLoggerAdvisor(){
        String response = chatClient.prompt()
                .advisors(new SimpleLoggerAdvisor())
                .user("Tell me a joke?")
                .call().content();
        System.out.println(response);
    }
}
